﻿/*************************************************************************
 * 
 * Filename :newstop
 * 
 * steven hu   2010/3/10 17:00:40
 *  
 * http://www.cnblogs.com/huxj
 *   
 * 
 * Change History:
 * 
 * 
**************************************************************************/



using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RicciWebsite.Model;

namespace RicciWebsite.UControls
{
    public partial class newstop : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            rptnewslist.DataSource = RicciDatabase.Default.From<data_news>().Top(topIndex).Where(data_news._.status != Common.NewsStatus.未发布.GetHashCode()).OrderBy(data_news._.subtime.Desc).ToList();
            rptnewslist.DataBind();
        }


        private int topIndex = 5;

        /// <summary>
        /// 
        /// </summary>
        public int TopIndex
        {
            get { return topIndex; }
            set { topIndex = value; }
        }


        /// <summary>
        /// 获取url
        /// </summary>
        /// <param name="nid"></param>
        /// <returns></returns>
        protected string GetUrl(object nid)
        {
            return ResolveUrl("~/news/newsdetail.aspx?nid=" + nid.ToString());
        }
    }
}